<template>
	<view>
		<view class="con">
			<view v-if="list.length>0">
				<view class="item" v-for="(item,index) in list" :key="index">
					<view class="item1">
						<image v-if="item.type=='GDB'" src="../static/r10.png"></image>
						<image v-if="item.type=='KMB'" src="../static/mtk_bg3.png"></image>
						<image v-if="item.type=='CASH'" src="../static/r9.png"></image>
						<image v-if="item.type=='RANGE_CASH'" src="../static/r11.png"></image>

					</view>
					<view class="item2">
						<view class="item2-a">
							<text v-if="item.type=='GDB'">金蜜 </text>
							<text v-if="item.type=='KMB'">蜜贝 </text>
							<text v-if="item.type=='CASH'">金蛋 </text>
							<text v-if="item.type=='RANGE_CASH'">彩蛋 </text>
							<text v-if="item.type=='CASH' || item.type=='RANGE_CASH'">
								<text  v-if="item.cash_send==0">（未发放）</text><text  v-if="item.cash_send==1">（已发放）</text>
								<text  v-if="item.cash_send==2">（已驳回）</text>
							</text>
							
						  <!-- {{item.type=='GDB'?'金蜜':(item.type=='KMB'?'蜜贝':'现金')}} -->
						</view>
						<view class="item2-b">{{item.createtime}}</view>
					</view>
					<view>
						<view>
							<text class="item6">获得</text>
							<!-- <text :class="item.flag=='IN'?'item3':'item4'">{{item.flag=='IN'?'+':'-'}}{{item.price}}</text> -->
							<text :class="item.flag=='IN'?'item3':'item4'">{{item.price}}</text>
							<text class="item7" v-if="item.type=='CASH' || item.type=='RANGE_CASH'">Fmb</text>
							<text class="item7" v-if="item.type=='GDB' || item.type=='KMB'">Gdb</text>
						</view>
				     	
					    <view class="item5" v-if="item.type=='CASH' || item.type=='RANGE_CASH'">已扣除12%个税</view>
					</view>
				</view>
			</view>
			<view class="none" v-else style="background: none;">
				<view class="none-view">
					<image src="../../../static/image/none.png" class="none-image"></image>
					<view class="none-name">
						暂无奖品
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				list: [],
				page: 1
			}
		},
		onLoad(option) {
			than = this;
			than.getList();
		},
		onShow() {

		},
		onReachBottom() {
			than.page++
			than.getList();
		},
		methods: {
			getList() {
				than.post("api/gashapon/gashaponList", {
					page: than.page
				}, function(data) {
					for (let i in data) {
						data[i].show = true

						if (data[i].price > 0) {
							data[i].flag = 'IN'
						}
					}
					if (than.page == 1) {
						than.list = data;
					} else {
						than.list = than.list.concat(data)
					}
					//console.log(than.list)
				})
			},
		}
	}
</script>

<style lang="less">
	page{
		background-color: #FAFAFA;
	}
	.con {
		padding: 30rpx;

		.item:first-child {
			margin-top: 0rpx;
		}

		.item {
			background:white;
			border-radius: 20rpx;
			padding: 30rpx;
			display: flex;
			align-items: center;
			margin-top: 20rpx;

			.item1 {
				width: 99rpx;
				height: 99rpx;
				background: #F8EEDF;
				border-radius: 20rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-right: 20rpx;

				image {
					width: 56rpx;
					height: 57rpx;
				}
			}

			.item2 {
				flex: 1;

				.item2-a {
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #333333;
				}

				.item2-b {
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #999999;
					margin-top: 20rpx;
				}
			}

			.item3 {
				font-size: 40rpx;
				font-family: DINCond-Black;
				font-weight: bold;
				color: #F66337;
			}

			.item4 {
				font-size: 30rpx;
				font-family: DINCond-Black;
				font-weight: bold;
				color: #999999;
			}
			.item5 {
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #999999;
				margin-top:10rpx;
				text-align: right;
			}
			.item6{
				font-size: 28rpx;
				font-weight: bold;
				color:#333333;
				margin-right:10rpx;
			}
			.item7{
				font-size: 32rpx;
				color: #F46813;
				margin-left:10rpx;
			}
		}
	}
</style>
